package com.sakiko.multimodel.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: com.sakiko.multimodel.controller
 *
 * @author: Yang
 * description: 多模型使用
 * time: 2025/8/17 10:27
 */
@RestController
@Slf4j
@RequestMapping("LLM")
public class MultiModelController {

    @Resource(name = "qwen")
    private ChatModel chatModelQwen;

    @Resource(name = "kimi")
    private ChatModel chatModelKimi;

    @GetMapping("/multimodel/qwen")
    public String qwenCall(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt) {
        String res = chatModelQwen.chat(prompt);
        System.out.println("res = " + res);
        return res;
    }

    @GetMapping("/multimodel/kimi")
    public String kimiCall(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt) {
        String res = chatModelKimi.chat(prompt);
        System.out.println("res = " + res);
        return res;
    }
}
